package com.tongji.admin.command
{
	import com.tongji.admin.event.BrandAdminEvent;
	import com.tongji.admin.model.BrandModel;
	import com.tongji.admin.service.HouseDiyAdminService;
	import com.tongji.admin.service.HouseDiyService;
	
	import mx.utils.OnDemandEventDispatcher;
	
	import org.robotlegs.mvcs.Command;
	
	/**
	 * 
	 * @author yanghanbing
	 * 2011/7/
	 */ 
	public class BrandAdminCommand extends Command
	{
		[Inject]
		public var event:BrandAdminEvent;
		
		[Inject]
		public var service:HouseDiyAdminService;
		
		[Inject]
		public var model:BrandModel;
		
		[Inject]
		public var service2:HouseDiyService;
		override public function execute():void
		{
			switch(event.type)
			{
				case "updateBrands":
					model.updateBrandArray(event.brandArray);
					break;
				case "addABrand":
					service.addBrand(event.brand);
					break;
				case "getAllBrands":
					service2.getBrands();
					break;
			}
		}
	}
}